home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / setDisplaySmoothness.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.0 KB  |  100 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  February 4, 1999
  22. //
  23. //  Author:         nrohm
  24. //
  25. //  Description:
  26. //
  27. //      This is the interface for display smoothness, so that both
  28. //      nurbs and subdivision surfaces smoothness can be changed 
  29. //      using the 1,2,3 keys.
  30. //
  31. //      First, pass everything off to nurbs displaySmoothness
  32. //
  33. //      If subdiv slice exists,
  34. //          Gets a list of subdivs and passes them off to 
  35. //          subdivDisplaySmoothness
  36. //      
  37.  
  38. global proc int setDisplaySmoothness(int $smoothness) 
  39. {
  40.     // Get the select list.
  41.     string $selList[] = `ls -sl`;
  42.     int $len = size($selList) ;
  43.  
  44.     if ($len == 0) {
  45.         $selList = `ls -hl`;
  46.         $len = size($selList) ;
  47.     }
  48.     if ($len == 0) {
  49.       error -showLineNumber 1 "Nothing selected.";
  50.       return 0;
  51.     }
  52.  
  53.     // If a single object (i.e. transform with one shape, or only a shape)
  54.     // is selected, and it is a polygon, give the user an error to let 
  55.     // them know that they cannot smooth a polygon.
  56.     //
  57.     if ($len == 1) {
  58.         string $shape = $selList[0];
  59.         string $id = `nodeType $shape`;
  60.         if ($id == "transform") {
  61.             string $children[] = `listRelatives -ni -f $shape`;
  62.             
  63.             // If there are multiple children or the poly is in a group
  64.             // then the error message is not needed.
  65.             
  66.             if (size($children) == 1) {
  67.                 $shape = $children[0];
  68.                 if ($shape != "") $id = `nodeType $shape`;
  69.             }
  70.         }
  71.         if ($id == "mesh") {
  72.             error ("Display smoothness does not work on polygon objects");
  73.         }
  74.     }
  75.       
  76.     // 
  77.     // Set nurbs display smoothness
  78.     //
  79.       if ($smoothness == 1) {
  80.         evalEcho("displaySmoothness -divisionsU 0 -divisionsV 0 -pointsWire 4 -pointsShaded 1");
  81.       }
  82.       else if ($smoothness == 2) {
  83.         evalEcho("displaySmoothness -divisionsU 1 -divisionsV 1 -pointsWire 8 -pointsShaded 2");
  84.       }
  85.       else if ($smoothness == 3) {
  86.         evalEcho("displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4");
  87.       }
  88.  
  89.     // 
  90.     // Set subdivision surfaces display smoothness
  91.     //
  92.     if (`isTrue "SubdivUIExists"`) {
  93.  
  94.         evalEcho("subdivDisplaySmoothness -smoothness " + $smoothness);
  95.  
  96.     }
  97.     
  98.     return 1;
  99. }
  100.